clear
rng default
load IdSetW_final_y1
IdSetW{1}=IdSetW_final_y1;
load IdSetW_final_y2
IdSetW{2}=IdSetW_final_y2;
load IdSetW_final_y3
IdSetW{3}=IdSetW_final_y3; 
load IdSetW_final_y4
IdSetW{4}=IdSetW_final_y4;
load IdSetW_final_y5
IdSetW{5}=IdSetW_final_y5;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in one dimension %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ntypes_w=5;
V_1=cell(ntypes_w,1);
V_2=cell(ntypes_w,1);
V_3=cell(ntypes_w,1);
V_4=cell(ntypes_w,1);
V_5=cell(ntypes_w,1);
for y=1:ntypes_w
    V_1{y}=[min(IdSetW{y}(:,2)); max(IdSetW{y}(:,2))];
    V_2{y}=[min(IdSetW{y}(:,3)); max(IdSetW{y}(:,3))];
    V_3{y}=[min(IdSetW{y}(:,4)); max(IdSetW{y}(:,4))];
    V_4{y}=[min(IdSetW{y}(:,5)); max(IdSetW{y}(:,5))];
    V_5{y}=[min(IdSetW{y}(:,6)); max(IdSetW{y}(:,6))];
end

save('V_intervals.mat', 'V_1', 'V_2', 'V_3', 'V_4', 'V_5')

clearvars -except IdSetW ntypes_w

 
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in two dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load V_CS
for y=1:ntypes_w
    %v2y v3y
    M=unique([IdSetW{y}(:,3) IdSetW{y}(:,4)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(2,y), V_CS(3,y), 60,'r', 'filled')
    xlabel(sprintf('V_{2%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{3%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_2%d_3%d.jpg',y,y))
    
    %v2y v4y
    M=unique([IdSetW{y}(:,3) IdSetW{y}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(2,y), V_CS(4,y), 60,'r', 'filled')
    xlabel(sprintf('V_{2%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{4%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_2%d_4%d.jpg',y,y))
    
    %v2y v5y
    M=unique([IdSetW{y}(:,3) IdSetW{y}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(2,y), V_CS(5,y), 60,'r', 'filled')
    xlabel(sprintf('V_{2%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{5%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_2%d_5%d.jpg',y,y))
    
    
    %v3y v4y
    M=unique([IdSetW{y}(:,4) IdSetW{y}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(3,y), V_CS(4,y), 60,'r', 'filled')
    xlabel(sprintf('V_{3%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{4%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_3%d_4%d.jpg',y,y))
    
    
    %v3y v5y
    M=unique([IdSetW{y}(:,4) IdSetW{y}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(3,y), V_CS(5,y), 60,'r', 'filled')
    xlabel(sprintf('V_{3%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{5%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_3%d_5%d.jpg',y,y))
    
    
    %v4y v5y
    M=unique([IdSetW{y}(:,5) IdSetW{y}(:,6)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(V_CS(4,y), V_CS(5,y), 60,'r', 'filled')
    xlabel(sprintf('V_{4%d}',y),'FontSize', 25) 
    ylabel(sprintf('V_{5%d}',y),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('V_4%d_5%d.jpg',y,y))
    

end


close all





